/*
 * ISimplifiedLapack.cs
 *
 * Interface to simplified LAPACK routines.
 *
 * Copyright (c) 2005, dnAnalytics. All rights reserved.
 */
namespace dnAnalytics.LinearAlgebra
{
    internal interface ISimplifiedLapack
    {
        /// <summary>
        /// Computes the L1 and Infinity condition numbers.
        /// </summary>
        double ConditionNumber(char norm, int order, double anorm, double[] luData, int[] pivots);
        
        /// <summary>
        /// Calculates the L1, Infinity, and Frobenius matrix norms.
        /// </summary>
        double Norm(char norm, int rows, int columns, double[] data); 
        
        /// <summary>
        /// LU factors a matrix.
        /// </summary>
        void LUFactor(int order, double[] factor, int[] pivots);
        
        /// <summary>
        /// Computes a matrix inverse from an LU factored matrix and its pivots.
        /// </summary>
        void LUInverse(int order, double[] inverse, int[] pivots);
        
        /// <summary>
        /// Solves Ax=B using the LU factor of A and its pivots.
        /// </summary>
        void LUSolve(int order, int columns, double[] factor, int[] pivots, double[] rightSide);

        /// <summary>
        /// Computes the Cholesky factorization.
        /// </summary>
        int CholeskyFactor(int order, double[] data);

        /// <summary>
        /// Solves Ax=B using the Cholesky factor of A.
        /// </summary>
        void CholeskySolve(int order, int columns, double[] data, double[] rhs);

        /// <summary>
        /// Computes the QR factorization.
        /// </summary>
        void QRFactor(int m, int n, double[] q, double[] r, double[] tau);
        
        /// Finds the least squares solution of <b>A*x = b</b>, where <b>m &lt;= n</b>
        void QRSolve(int m, int n, int bn, double[] q, double[] r, double[] b, double[] tau);

        /// <summary>
        /// Computes the singular value decomposition of matrix.
        /// </summary>
        int SVDDecomposition(int rows, int cols, double[] a, double[] s, double[] u, double [] v);
    }
}
